﻿<%@ Page Language="C#" MasterPageFile="~/Layouts/List.Master" AutoEventWireup="true"
    Inherits="HHMMS.UI.Modules.PlanManager.DiscardPartsChoice" Title="配件报废记录列表" CodeBehind="DiscardPartsChoice.aspx.cs" %>

<asp:Content ContentPlaceHolderID="head" ID="idFormTitle" runat="server">
    <!-- title -->
</asp:Content>

<asp:Content ID="idContent" ContentPlaceHolderID="Content" runat="Server">   
    <!-- 搜索框 -->
    <div class="search" style="margin-top:2px;">     
        <web:search ID="GridSearch" GridViewId="SmartGridView1" runat="server">            
            <SearchConditionTemplate>                                       
                <table cellpadding="0" cellspacing="0" width="95%">
                    <tr>
			            <th>配件名称：</th>
                        <td>
                            <asp:TextBox ID="tbPartName" Name="PartName" runat="server"></asp:TextBox>
                            <asp:HiddenField ID="Status" Value="3" runat="server" />
                        </td> 
                        <th>规格型号：</th>
                        <td>
                            <asp:TextBox ID="tbPartModel" Name="PartModel" runat="server"></asp:TextBox>
                        </td>            
			            <th>配件编号：</th>
                        <td>
                            <asp:TextBox ID="tbPartNo" Name="PartNo" runat="server"></asp:TextBox>
                        </td>          
					</tr>
                </table>
            </SearchConditionTemplate>                      
        </web:search>
    </div>

    <div class="datalist">
        <!-- 标题头 -->
        <h2 style="height:30px;">报废配件列表</h2>
        <!-- 工具栏 -->
        <div class="toolbar"  style="height:30px;">
            
        </div>
        <div class="datagrid"  style="clear:left;">    
            <!--------------------------- List Area --------------------------->
            <web:SmartGridView ID="SmartGridView1" runat="server" AutoGenerateColumns="False"
                Width="100%" DataKeyNames="Id" DataSourceID="SmartDataSource1" PageSize="10">
                <Columns>   
                    <asp:BoundField DataField="PartName" HeaderText="配件名称" SortExpression="PartName" ItemStyle-HorizontalAlign = "Left"  />
                    <asp:BoundField DataField="PartModel" HeaderText="配件型号规格" SortExpression="PartModel" ItemStyle-HorizontalAlign = "Center"  />
                    <asp:BoundField DataField="Count" HeaderText="报废数量(件)" SortExpression="Count" ItemStyle-HorizontalAlign = "Center"  />
                    <asp:BoundField DataField="PartNo" HeaderText="配件编号" SortExpression="PartNo" ItemStyle-HorizontalAlign = "Left"  />
                    <asp:BoundField DataField="RemainCount" HeaderText="剩余备品数量(件)" SortExpression="RemainCount" ItemStyle-HorizontalAlign = "Center"  />
                    <asp:BoundField DataField="CreateTime" HeaderText="申请时间" SortExpression="CreateTime" ItemStyle-HorizontalAlign = "Center" DataFormatString="{0:yyyy-MM-dd HH:mm}"  />
                    <asp:BoundField DataField="ApprovalUserName" HeaderText="审批人" SortExpression="ApprovalUserName" ItemStyle-HorizontalAlign = "Center"  />
                    <asp:BoundField DataField="ApprovalTime" HeaderText="审批通过时间" SortExpression="ApprovalTime" ItemStyle-HorizontalAlign = "Center" DataFormatString="{0:yyyy-MM-dd HH:mm}"  />
                    <asp:TemplateField HeaderText="操作">
                        <ItemStyle HorizontalAlign="Center" />
                        <HeaderStyle Wrap="False" HorizontalAlign="Center" />
                        <ItemTemplate>
                            <table width="46px">
                                <tr>                                    
                                    <td style="border: 0px solid #fff;">
                                        <asp:ImageButton runat="server" ToolTip="选择" _PartName='<%#Eval("PartName")%>' _PartModel='<%#Eval("PartModel")%>'
                                            ImageUrl="~/images/ico_start.gif" CausesValidation="False" OnClientClick="return selectComplete(this);" OnClick="RefreshGrid">
                                        </asp:ImageButton>
                                    </td>
                                </tr>
                            </table>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <PagerSettings />
                <EditRowStyle HorizontalAlign="Center" />
            </web:SmartGridView>
    
            <web:SmartSqlDataSource ID="SmartDataSource1" runat="server" SelectCommand="PlanManager.PartsDiscardRecord.List" SelectCountCommand="PlanManager.PartsDiscardRecord.List.Count"
                    DefaultSortExpression="Id DESC" SelectCommandAutoPageWrap="true">
            </web:SmartSqlDataSource>
        </div>
    </div>

    <script type="text/javascript">
        function selectComplete(sender) {
            var id = $(sender).attr("_PartModel");
            var text = $(sender).attr("_PartName");
            window.returnValue = [{ id: id, text: text}];
            window.close();
            return false;
        }      
    </script>

</asp:Content>